package com.ljf.interestingmaps.util;

import android.content.Context;
import android.content.SharedPreferences;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Const {

    public static final String LOCAL_PATH = "https://bookdatabase.biz/";

    public static String getTime() {
        long currentTime = System.currentTimeMillis();
        Date date = new Date(currentTime);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(date);
    }

    public static String getTimeZone() {
        return TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT);
    }

    public static String readCh(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("channel_path", Context.MODE_PRIVATE);
        return preferences.getString("channel", "");
    }

    public static void saveCh(Context context, String referrer) {
        SharedPreferences preferences = context.getSharedPreferences("channel_path", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString("channel", referrer);
        editor.commit();
    }
}
